#include <string.h>
#include "memory.h"

int mem_set(BYTE addr, BYTE val)
{
    if (addr >= MEM_SIZE)
    {
        return R_FAIL_OUT_OF_RANGE;
    }

    g_mem[addr] = val;
    return R_SUCCESS;
}

int mem_get(BYTE addr, BYTE* res)
{
    if (addr >= MEM_SIZE)
    {
        return R_FAIL_OUT_OF_RANGE;
    }

    *res = g_mem[addr];
    return R_SUCCESS;
}

void mem_cpy(const BYTE* const src, BYTE len)
{
    memcpy(g_mem, src, len);
}